m4_define([gdk_pixbuf_required_version], [2.30.0])
m4_define([introspection_required_version], [1.39.0])
m4_define([wayland_required_version], [1.9.91])
-m4_define([wayland_protocols_required_version], [1.5])
+m4_define([wayland_protocols_required_version], [1.6])
m4_define([mirclient_required_version], [0.22.0])
m4_define([mircookie_required_version], [0.17.0])
m4_define([epoxy_required_version], [1.0])
#include "pointer-gestures-unstable-v1-client-protocol.h"
#include "tablet-unstable-v2-client-protocol.h"
#include "xdg-shell-unstable-v6-client-protocol.h"
+#include "xdg-foreign-unstable-v1-client-protocol.h"
/**
* SECTION:wayland_interaction
wl_registry_bind(display_wayland->wl_registry, id,
&zwp_tablet_manager_v2_interface, 1);
}
+ else if (strcmp (interface, "zxdg_exporter_v1") == 0)
+ {
+ display_wayland->xdg_exporter =
+ wl_registry_bind (display_wayland->wl_registry, id,
+ &zxdg_exporter_v1_interface, 1);
+ }
else
handled = FALSE;
struct wl_subsurface *wl_subsurface;
struct wl_egl_window *egl_window;
struct wl_egl_window *dummy_egl_window;
+ struct zxdg_exported_v1 *xdg_exported;
} display_server;
EGLSurface egl_surface;
int height;
GdkWindowState state;
} pending;
+
+ struct {
+ GdkWaylandWindowExported callback;
+ gpointer user_data;
+ GDestroyNotify destroy_func;
+ } exported;
};
struct _GdkWindowImplWaylandClass
impl->pending_buffer_offset_x = x;
impl->pending_buffer_offset_y = y;
}
+
+static void
+xdg_exported_handle (void *data,
+ struct zxdg_exported_v1 *zxdg_exported_v1,
+ const char *handle)
+{
+ GdkWindow *window = data;
+ GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
+
+ impl->exported.callback (window, handle, impl->exported.user_data);
+ impl->exported.user_data = NULL;
+}
+
+static const struct zxdg_exported_v1_listener xdg_exported_listener = {
+ xdg_exported_handle
+};
+
+/**
+ * gdk_wayland_window_export_handle:
+ *
+ * Stability: unstable
+ */
+gboolean
+gdk_wayland_window_export_handle (GdkWindow *window,
+ GdkWaylandWindowExported callback,
+ gpointer user_data,
+ GDestroyNotify destroy_func)
+{
+ GdkWindowImplWayland *impl;
+ GdkWaylandDisplay *display_wayland;
+ GdkDisplay *display = gdk_window_get_display (window);
+ struct zxdg_exported_v1 *xdg_exported;
+
+ g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), FALSE);
+ g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY (display), FALSE);
+
+ impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
+ display_wayland = GDK_WAYLAND_DISPLAY (display);
+
+ g_return_val_if_fail (!impl->display_server.xdg_exported, FALSE);
+
+ if (!display_wayland->xdg_exporter)
+ {
+ g_warning ("Server is missing xdg_foreign support");
+ return FALSE;
+ }
+
+ xdg_exported = zxdg_exporter_v1_export (display_wayland->xdg_exporter,
+ impl->display_server.wl_surface);
+ zxdg_exported_v1_add_listener (xdg_exported, &xdg_exported_listener, window);
+
+ impl->display_server.xdg_exported = xdg_exported;
+ impl->exported.callback = callback;
+ impl->exported.user_data = user_data;
+ impl->exported.destroy_func = destroy_func;
+
+ return TRUE;
+}
+
+/**
+ * gdk_wayland_window_unexport_handle:
+ *
+ * Stability: unstable
+ */
+void
+gdk_wayland_window_unexport_handle (GdkWindow *window)
+{
+ GdkWindowImplWayland *impl;
+
+ g_return_if_fail (GDK_IS_WAYLAND_WINDOW (window));
+
+ impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
+
+ g_return_if_fail (impl->display_server.xdg_exported);
+
+ g_clear_pointer (&impl->display_server.xdg_exported,
+ zxdg_exported_v1_destroy);
+ g_clear_pointer (&impl->exported.user_data,
+ impl->exported.destroy_func);
+}